JLabel
JLabel
Class
Here is a constructor for JLabel
:
JLabel(
"Some Words" )
It constructs an object which can be added to the content pane of a frame. Its size and location is managed by the layout manager. Here is our sample program:
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class TextEg2 extends JFrame { JTextField text; _______ lbl ; public TextEg2() { text = new JTextField( 15 ) ; lbl = new _______ ( ________ ); getContentPane().setLayout( new FlowLayout() ); getContentPane().add( ____ ); getContentPane().add( ____ ); } public static void main ( String[] args ) { . . . . . } }
With FlowLayout
,
components are put into the frame
left to right, top to bottom
in the order that they are added.